import request from '../utils/request';
import constant from '../constant/constant'
import qs from 'qs';

/**
 * 管理委员会上传资料保存至服务器
 */
export function uploadFile(payload) {
    let option = {
        method: 'POST',
        body: payload,
        headers: {
        },
        mode: "cors",
    }
    return request(constant.serverUrl + '/tvs/api/attachments/data/information/create', option)
}

/**
 * 按类型查找文件
 */
export function queryFile(payload){
    let option = {
        method: 'POST',
        body: qs.stringify(payload),
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        mode: "cors",
    }
    return request(constant.serverUrl + '/tvs/api/information/list/informationType', option)
}

/**
 * 管理委员会删除已上传文件
 */
export function deleteFile(payload){
    let option = {
        method: 'POST',
        body: qs.stringify(payload),
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        mode: "cors",
    }
    return request(constant.serverUrl + '/tvs/api/information/delete/byid', option)
}